package com.xtkj.superclub_user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xtkj.superclub_entity.entity.user.User;
import com.xtkj.superclub_user.dao.IUserDao;
import com.xtkj.superclub_user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author lizheqi
 * @create 2019-12-23-20:15
 */
@Service
public class UserServiceImpl implements IUserService {
    @Autowired
    private IUserDao userDao;


    @Override
    public User checkLogin(User user) {
       return userDao.checkLogin(user);
    }

    @Override
    public void userRegister(User user) {
        userDao.userRegister(user);
    }

    @Override
    public void updateUser(User user) {
        userDao.updateUser(user);
    }

    @Override
    public User getUserById(String userId) {
        return userDao.selectById(userId);
    }

    @Override
    public User getUserByTel(String telephone) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("telephone",telephone);
        return userDao.selectOne(wrapper);
    }
}
